﻿Imports DTO
Imports System.Data.OleDb
Public Class TinhTrangDAO
    Public Function laytinhtrang() As List(Of TinhTrangDTO)
        Dim sql = "select MaTinhTrang,TenTinhTrang from TinhTrang"
        Dim con As OleDbConnection = DatabaseProvider.connectData()
        Dim cmd As New OleDbCommand(sql, con)
        Dim reader As OleDbDataReader = cmd.ExecuteReader()
        Dim danhsach As New List(Of TinhTrangDTO)
        While reader.Read()
            Dim cvDTO As New TinhTrangDTO()
            cvDTO.MaTinhTrang = reader("MaTinhTrang")
            cvDTO.TenTinhTrang = reader("TenTinhTrang")
            danhsach.Add(cvDTO)
        End While
        con.Close()
        Return danhsach
    End Function
End Class
